home *** CD-ROM | disk | FTP | other *** search
- Path: jaxnet.jaxnet.com!jax!garyg
- From: garyg@jax.jaxnet.com (Gary M. Greenberg)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie doesn't understand compiler error
- Date: 10 Mar 1996 15:28:33 GMT
- Organization: Southeast Network Services, Inc.
- Message-ID: <4husf1$eui@jaxnet.jaxnet.com>
- References: <Pine.SUN.3.91.960301153010.11258B-100000@pioneer.uspto.gov>
- NNTP-Posting-Host: jax.jaxnet.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Max Schubert (schubert@pioneer.uspto.gov) wrote:
- : I have just started to work with two different learning C books. They
- : both have programs to copy and compile as I go along. Twice I have
- : received this error from cc when attempting to compile two separate
- ^^^^
- : programs on SunOS 4.1.2:
- ^^^^^^^
-
- Those 2 facts (cc && SunOS 4.1.2) indicate that your compiler is pre-ANSI C.
- Therefore, programs written with this compiler will require K & R style
- function definitions.
-
- : #include <stdio.h>
-
- : void do_heading(char *filename);
-
- : int line, page;
-
- : main( int argv, char *argc[] ) <<- Compiler states "Syntax error at or near
- : { word type char."
-
- Two points:
- 1. argc and argv are typically the other way. Argc infers Count,
- and argv infers Vector into the Array of argument strings.
- It will work as written, but may lead to confusion.
- 2. For your compiler, use:
-
- int main(argc,argv)
- int argc,
- char **argv;
- {
- /* rest of code */
- }
-
- : Do I need to update my compiler?
-
- Probably in your best interest; the pre-ANSI C compiler supplied with SunOS
- lacks other features of the ANSI C standard.
-
- C'ya,
-
- gary /* the Sorcerer's Apprentice */
-
- The Communications Decency Act is proof:
- (((U.S. Congress && Executive)==(Collective Moron))==1)
-